<?php

//----
// Language file alphabetizer and prettifier!
//----

// load lang file:
require_once('cache/lang_cache/en/lang_ineo.php');

// alphabetically sort by key:
ksort($lang);

// loop through and get the longest key:
$max_key = 0;
foreach( $lang as $key => $value )
{
	if( strlen($key) > $max_key )
	{
		$max_key = strlen($key);
	}
}

// loop through again and build our lang_array string:
$lang_array = '';
foreach($lang as $key => $value)
{
	$string = "\t'{$key}'";
	
	for( $i = strlen($key); $i <= $max_key; $i++ )
	{
		$string .= ' ';
	}
	
	$value = str_replace('\'','\\\'',$value);
	
	$string .= " => '{$value}',\n";
	
	$lang_array .= $string;
}

// build file from generated string:
$file_content = "<?php

// ineo language file

\$lang = array
(
$lang_array);

?>";

file_put_contents('cache/lang_cache/en/lang_ineo.php',$file_content);
?>